# -*- coding: UTF-8 -*-
import os
from configparser import ConfigParser

from handle.handle_path import SYSCONFIGDIR


class HandleSysconfig(ConfigParser):
    def __init__(self, filename):
        super().__init__()
        self.filename = filename

        """
        读取文件
        """
        self.read(filename, encoding="utf-8")

    def write_data(self, section, option, value=None):
        """
        向配置文件写信息
        :param section:
        :param option:
        :param value:
        :return:
        """
        self.set(section, option, value)

        """
        将内容写到文件里
        """
        self.write(fp=open(self.filename, encoding='utf-8'))


conf = HandleSysconfig(SYSCONFIGDIR+"/sysconfig.ini")

if __name__ == "__main__":
    print(conf.get("log", "name"))